import * as houseService from '../service/houseService';
export default {
    namespace: "houseModel",
    state: {
      
    },
  
    subscriptions: {
      setup({ dispatch, history }) {},
    },
  
    effects: {
      //新增物资库
      *getaddData({ payload }, { call, put, select }) {
        let { params, callback } = payload;
        let res = yield call(houseService.getaddOrUpd, params);

        if (res.data.code  === 0) {
            let data = res.data;
            if (callback) {
                callback(data)
            }
        }
    },

    //删除物资库
    *getdelData({ payload }, { call, put, select }) {
        let { params, callback } = payload;
        let res = yield call(houseService.getdel, params);

        if (res.data.code  === 0) {
            let data = res.data.msg;
            if (callback) {
                callback(data)
            }
        }
    },

    //查询物资库
    *getlistData({ payload }, { call, put, select }) {
        let { params, callback } = payload;
        let res = yield call(houseService.getlist, params);
        if (res.data.code  === 0) {
            let data = res.data.res;
            if (callback) {
                callback(data)
            }
        }
    },
    },
  
    reducers: {
      
    },
  };
  